home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_libcodebrws.inc < prev    next >
Encoding:
Text File  |  1999-05-12  |  4.0 KB  |  168 lines

  1. <%
  2.     Function fMin(iNum1, iNum2)
  3.         If iNum1 = 0 AND iNum2 = 0 Then
  4.             fMin = -1
  5.         ElseIf iNum2 = 0 Then
  6.             fMin = iNum1
  7.         ElseIf iNum1 = 0 Then
  8.             fMin = iNum2
  9.         ElseIf iNum1 < iNum2 Then
  10.             fMin = iNum1
  11.         Else 
  12.             fMin = iNum2
  13.         End If
  14.     End Function
  15. %>
  16.  
  17. <%
  18.     Function fCheckLine (ByVal strLine)
  19.         Dim iTemp, iPos
  20.         fCheckLine = 0
  21.         iTemp = 0
  22.  
  23.         iPos = InStr(strLine, "<" & "%")
  24.         If fMin(iTemp, iPos) = iPos Then
  25.             iTemp = iPos
  26.             fCheckLine = 1
  27.         End If
  28.  
  29.         iPos = InStr(strLine, "%" & ">")
  30.         If fMin(iTemp, iPos) = iPos Then
  31.             iTemp = iPos
  32.             fCheckLine = 2
  33.         End If
  34.  
  35.         iPos = InStr(1, strLine, "<" & "SCRIPT", 1)
  36.         If fMin(iTemp, iPos) = iPos Then
  37.             iTemp = iPos
  38.             fCheckLine = 3
  39.         End If
  40.  
  41.         iPos = InStr(1, strLine, "<" & "/SCRIPT", 1)
  42.         If fMin(iTemp, iPos) = iPos Then
  43.             iTemp = iPos
  44.             fCheckLine = 4
  45.         End If
  46.  
  47.         iPos = InStr(1, strLine, "<" & "!--", 1)
  48.         If fMin(iTemp, iPos) = iPos Then
  49.             iTemp = iPos
  50.             fCheckLine = 5
  51.         End If
  52.  
  53.         iPos = InStr(1, strLine, "-" & "->", 1)
  54.         If fMin(iTemp, iPos) = iPos Then
  55.             iTemp = iPos
  56.             fCheckLine = 6
  57.         End If
  58.  
  59.         iPos = InStr(1, strLine, "'", 1)
  60.         If fMin(iTemp, iPos) = iPos Then
  61.             iTemp = iPos
  62.             fCheckLine = 7
  63.         End If
  64.  
  65.     End Function
  66. %>
  67.  
  68. <%
  69.     Sub PrintHTML (ByVal strLine)
  70.         Dim iPos, iSpaces, i
  71.         iSpaces = Len(strLine) - Len(LTrim(strLine))
  72.         i = 1
  73.         
  74.         While Mid(Strline, i, 1) = Chr(9)
  75.             iSpaces = iSpaces + 5
  76.             i = i + 1
  77.         Wend
  78.         
  79.         If iSpaces > 0 Then
  80.             For i = 1 to iSpaces
  81.                 Response.Write(" ")
  82.             Next
  83.         End If
  84.         
  85.         iPos = InStr(strLine, "<")
  86.         If iPos Then
  87.             Response.Write(Left(strLine, iPos - 1))
  88.             Response.Write("<")
  89.             strLine = Right(strLine, Len(strLine) - iPos)
  90.             Call PrintHTML(strLine)
  91.         Else
  92.             Response.Write(strLine)
  93.         End If
  94.  
  95.     End Sub
  96. %>
  97.  
  98. <%
  99.     Sub PrintLine (ByVal strLine, iFlag)
  100.         Dim iPos
  101.         
  102.         Select Case iFlag
  103.         
  104.             Case 0
  105.                 Call PrintHTML(strLine)
  106.  
  107.             Case 1
  108.                 iPos = InStr(strLine, "<" & "%")
  109.                 Call PrintHTML(Left(strLine, iPos - 1))
  110.                 Response.Write("<FONT COLOR=" & strServerSideColor & ">")
  111.                 Response.Write("<%")
  112.                 strLine = Right(strLine, Len(strLine) - (iPos + 1))
  113.                 Call PrintLine(strLine, fCheckLine(strLine))
  114.  
  115.             Case 2
  116.                 iPos = InStr(strLine, "%" & ">")
  117.                 Call PrintHTML(Left(strLine, iPos -1))
  118.                 Response.Write("%>")
  119.                 Response.Write("</FONT>")
  120.                 strLine = Right(strLine, Len(strLine) - (iPos + 1))
  121.                 Call PrintLine(strLine, fCheckLine(strLine))
  122.  
  123.             Case 3
  124.                 iPos = InStr(1, strLine, "<" & "SCRIPT", 1)
  125.                 Call PrintHTML(Left(strLine, iPos - 1))
  126.                 Response.Write("<FONT COLOR=" & strClientSideColor & ">")
  127.                 Response.Write("<SCRIPT")
  128.                 strLine = Right(strLine, Len(strLine) - (iPos + 6))
  129.                 Call PrintLine(strLine, fCheckLine(strLine))
  130.  
  131.             Case 4
  132.                 iPos = InStr(1, strLine, "<" & "/SCRIPT>", 1)
  133.                 Call PrintHTML(Left(strLine, iPos - 1))
  134.                 Response.Write("</SCRIPT>")
  135.                 Response.Write("</FONT>")
  136.                 strLine = Right(strLine, Len(strLine) - (iPos + 8))
  137.                 Call PrintLine(strLine, fCheckLine(strLine))
  138.  
  139.             Case 5
  140.                 iPos = InStr(1, strLine, "<" & "!--", 1)
  141.                 Call PrintHTML(Left(strLine, iPos - 1))
  142.                 Response.Write("<FONT COLOR=" & strCommentsColor & ">")
  143.                 Response.Write("<!--")
  144.                 strLine = Right(strLine, Len(strLine) - (iPos + 3))
  145.                 Call PrintLine(strLine, fCheckLine(strLine))
  146.  
  147.             Case 6
  148.                 iPos = InStr(1, strLine, "-" & "->", 1)
  149.                 Call PrintHTML(Left(strLine, iPos - 1))
  150.                 Response.Write("-->")
  151.                 Response.Write("</FONT>")
  152.                 strLine = Right(strLine, Len(strLine) - (iPos + 2))
  153.                 Call PrintLine(strLine, fCheckLine(strLine))
  154.  
  155.             Case 7
  156.                 iPos = InStr(1, strLine, "'", 1)
  157.                 Call PrintHTML(Left(strLine, iPos - 1))
  158.                 Response.Write("<FONT COLOR=" & strCommentsColor & ">")
  159.                 Response.Write(Right(strLine, Len(strline) - (iPos - 1)))
  160.                 Response.Write "</FONT>"
  161.  
  162.             Case Else
  163.                 Response.Write("Function Error -- Please contact the administrator.")
  164.         
  165.         End Select
  166.  
  167.     End Sub
  168. %>